<template>
  <div class="AuthorityList">
    <el-table
      :data="list"
      :border="true"
      stripe
      style="width: 100%"
    >
      <el-table-column
        label="#"
        width="60"
        type="index"
      />
      <el-table-column
        prop="authName"
        label="权限名称"
      />
      <el-table-column
        prop="path"
        label="路径"
      />
      <el-table-column
        label="权限登记"
      >
        <template scope="{row}">
          <el-tag v-if="row.level === '0'">一级</el-tag>
          <el-tag v-else-if="row.level === '1'" type="success">二级</el-tag>
          <el-tag v-else type="warning">三级</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getAllPower } from '@/api/power.js'
export default {
  name: 'AuthorityList',
  data() {
    return {
      list: []
    }
  },

  created() {
    this.loadAllPower()
  },

  methods: {
    async loadAllPower() {
      const res = await getAllPower('list')
      this.list = res.data
    }
  }
}
</script>

<style scoped lang='scss'>
.AuthorityList{
  padding: 20px;
  background-color: #fff;
}
.el-table{
  margin-top: 15px;
}
</style>
